Basic authentication
Basic authentication is supported only for legacy reasons
With new implementations, please use OAuth2.0 which is preferred way to authenticate against Jakamo. With new integrations, using basic authentication is prevented as a default.
1. Overview
Basic - or HTTP - Authentication simply means the client sends a username and password with every request. It is very simple to set up, but the credentials are encoded in plain text (but naturally protected by TLS). Basic authentication is an outdated industry standard and any new Jakamo API connectors should not use it.
In the not-too-distant future Jakamo will retire Basic authentication.
2. Steps to use Basic authentication
- Log in to Jakamo as a user with Company Admin credentials
- From the upper left menu, select
Integrations
- From the listing of your integrations, select
Change Credentials
- Enter a username and password. The username must be at least 5 characters long, and passwords are checked to make sure they are not extremely easy to guess, and that they are not found in lists of leaked passwords found on the dark web.
3. Testing using Postman
- Open Postman and create a new request
- In the Authorization tab, for
Type
, selectBasic
- Enter the username and password you selected
- Run the request
4. C# sample
using System.Net.Http.Headers;
using System.Text;
const string username = "username";
const string password = "password";
var encodedCredentials = Convert.ToBase64String(
Encoding.UTF8.GetBytes($"{username}:{password}")
);
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
encodedCredentials
);
var request = await httpClient.GetAsync("{url}/order/response");
var responseContent = await request.Content.ReadAsStringAsync();
Console.WriteLine(responseContent);
C:/Projects/Labs/JakamoBasicAuthSample/JakamoBasicAuthSample/bin/Debug/net7.0/JakamoBasicAuthSample.exe
<status>No more messages available.</status>
5. Java sample
package com.example;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.net.http.HttpRequest;
import java.util.Base64;
public final class App {
public static void main(String[] args) {
try {
String encoding = Base64.getEncoder().encodeToString(("username:password").getBytes());
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.GET()
.uri(new URI("{url}/order/response"))
.header("Authorization", "Basic " + encoding)
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
$ java com.example.App
<status>No more messages available.</status>
6. Node.JS sample
const axios = require('axios');
const res = axios.get('{url}/order/response', {
auth: {
username: 'username',
password: 'password'
}
}).then(response => {
console.log(response.data);
});
C:\Program Files\nodejs\node.exe .\app.js
<status>No more messages available.</status>
Help & Support
Didn't you find what you were looking for? Send an email to Jakamo support (support@thejakamo.com) and we will help you.